package cn.com.surker.material.dao;

import cn.com.surker.material.entity.MaterialStorageItem;
import cn.com.surker.material.entity.MaterialStorageItemDetail;
import cn.com.surker.material.entity.MaterialWarehouseInventory;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

import java.util.List;
import java.util.Map;

/**
 * <p>
 * 材料入库记录 Mapper 接口
 * </p>
 *
 * @author admin
 * @since 2023-07-19
 */
public interface MaterialStorageItemDao extends BaseMapper<MaterialStorageItem> {

	List<MaterialStorageItemDetail> findDetailByStorageId(Long sid, String materialName);

	/**
	 * 查询入库详情总数(财务对账)
	 * @param orgId
	 * @param startTime
	 * @param endTime
	 * @param searchVal
	 * @param supplierId 供应商ID
	 * @param warehouseId 仓库ID
	 * @return
	 */
	Integer findStorageTotal(Long orgId, String startTime, String endTime, String searchVal,
                             Long supplierId, Long warehouseId);
	/**
	 * 查询入库金额合计(财务对账)
	 * @param orgId
	 * @param startTime
	 * @param endTime
	 * @param searchVal
	 * @param supplierId 供应商ID
	 * @param warehouseId 仓库ID
	 * @return
	 */
	Map<String, Object> findStorageSum(Long orgId, String startTime, String endTime, String searchVal,
                                       Long supplierId, Long warehouseId);

	/**
	 * 分页查询入库详情(财务对账)
	 * @param orgId
	 * @param startTime
	 * @param endTime
	 * @param searchVal
	 * @param supplierId 供应商ID
	 * @param warehouseId 仓库ID
	 * @param offset
	 * @param limit
	 * @return
	 */
	List<Map<String, Object>> findStoragePage(Long orgId, String startTime, String endTime, String searchVal,
                                              Long supplierId, Long warehouseId, Integer offset, Integer limit);
	/**
	 * 入库明细
	 * @param orgId 公司ID
	 * @param startTime 开始时间
	 * @param endTime 结束时间
	 * @return
	 */
	List<Map<String, Object>> findStorageDetail(Long orgId, String startTime, String endTime);

	/**
	 *
	 * 查询实时库存
	 * @param orgId				站点
	 * @param materialName 		材料名称
	 * @param warehouseName		仓库名称
	 */
	List<MaterialWarehouseInventory> findInventory(Long orgId, String materialName, String warehouseName);
}
